package projectManagement;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class ViewTask extends JPanel implements ActionListener{
	private JTextField txtDate;

	/**
	 * @wbp.parser.constructor
	 */
	public ViewTask(String date) {
		setPreferredSize(new Dimension(462, 338));
		setLayout(null);
		
		txtDate = new JTextField();
		txtDate.setText(date);
		txtDate.setEditable(false);
		txtDate.setBounds(10, 30, 122, 32);
		add(txtDate);
		txtDate.setColumns(10);
		
		JLabel lblDate = new JLabel("Date");
		lblDate.setHorizontalAlignment(SwingConstants.LEFT);
		lblDate.setBounds(10, 11, 46, 19);
		add(lblDate);
		
		JLabel lblMessage = new JLabel("Message");
		lblMessage.setBounds(10, 69, 46, 19);
		add(lblMessage);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 90, 442, 209);
		add(scrollPane);
		
		JTextArea txtMessage = new JTextArea();
		scrollPane.setViewportView(txtMessage);
		
		JButton btnOk = new JButton("OK");
		btnOk.setBounds(10, 301, 89, 32);
		add(btnOk);
		
		JButton btnCancel = new JButton("CANCEL");
		btnCancel.setBounds(363, 301, 89, 32);
		add(btnCancel);
		
		
		JFrame f = new JFrame();
		f.getContentPane().add(this);
		f.setVisible(true);
		f.setResizable(false);
		f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		f.pack();
		f.setLocationRelativeTo(null);
	}
	
	public ViewTask(String date, String msg) {
		setPreferredSize(new Dimension(462, 338));
		setLayout(null);
		
		txtDate = new JTextField();
		txtDate.setText(date);
		txtDate.setEditable(false);
		txtDate.setBounds(10, 30, 122, 32);
		add(txtDate);
		txtDate.setColumns(10);
		
		JLabel lblDate = new JLabel("Date");
		lblDate.setHorizontalAlignment(SwingConstants.LEFT);
		lblDate.setBounds(10, 11, 46, 19);
		add(lblDate);
		
		JLabel lblMessage = new JLabel("Message");
		lblMessage.setBounds(10, 69, 46, 19);
		add(lblMessage);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 90, 442, 209);
		add(scrollPane);
		
		JTextArea txtMessage = new JTextArea();
		txtMessage.setEditable(false);
		txtMessage.setText(msg);
		scrollPane.setViewportView(txtMessage);
		
		JButton btnOk = new JButton("CLOSE");
		btnOk.setBounds(10, 301, 89, 32);
		add(btnOk);
		
		
		JFrame f = new JFrame();
		f.getContentPane().add(this);
		f.setVisible(true);
		f.setResizable(false);
		f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		f.pack();
		f.setLocationRelativeTo(null);
	}

	@Override
	public void actionPerformed(ActionEvent btn) {
		String command = btn.getActionCommand();
		
		if(command.equalsIgnoreCase("CANCEL")){
			
		}
		
		if(command.equalsIgnoreCase("CLOSE")){
			
		}
		
		if(command.equalsIgnoreCase("OK")){
			
		}
		
	}
}
